<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiRequest;

/**
 * @property int video_type_id
 * @property string name
 * @property int per_page
 * @property mixed order_by
 * @property mixed sort
 */
class VideoIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'video_type_id' => 'sometimes|numeric',
            'name'          => 'sometimes|string',
            'order_by'      => 'sometimes|string|in:sort,created_at',
            'sort'          => 'sometimes|string|in:desc,asc',
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'video_type_id.*' => '视频类型必须是数字',
            'name.*'          => '视频名称必须是字符串',
            'order_by.*'      => '排序的字段必须是字符串',
            'sort.*'          => '排序的顺序必须是字符串',
        ];
    }
}
